package com.winchain.chainbill.serfee.rx;

import com.shell.framework.rx.OnErrorNotImplementedSubscriber;
import com.winchain.chainbill.basic.charge.po.ValRetBiz;
import com.winchain.chainbill.basic.charge.service.ValRetBizService;
import com.winchain.chainbill.bill.base.po.CbDct;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.BillEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillDctUpdateSerFeeSubscriber extends OnErrorNotImplementedSubscriber<BillEvent<CbDct>> {
	@Autowired
	private ValRetBizService valRetBizService;

	public void onApplicationEvent(BillEvent<CbDct> t) {
		CbDct dct = (CbDct) t.getBill().getSource();
		ValRetBiz valRetBiz = this.valRetBizService.selectByBizId(dct.getDctId());
		if (valRetBiz != null) {
			valRetBiz.setState("1");
			this.valRetBizService.updateNotNull(valRetBiz);
		}
	}
}
